/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.h2t.loveplace.main;

import com.h2t.loveplace.models.Place;
import com.h2t.loveplace.views.CameraCapture;
import com.h2t.loveplace.views.MainView;
import com.h2t.loveplace.views.MapView;
import com.h2t.loveplace.views.ViewAboutUs;
import com.h2t.loveplace.views.ViewDetailPlace;
import com.h2t.loveplace.views.ViewGuide;
import com.h2t.loveplace.views.ViewNewPlace;
import com.h2t.loveplace.views.components.Map;
import com.sun.lwuit.Display;
import javax.microedition.midlet.*;

/**
 * @author PHAN THAI
 */
public class LoveplaceMidlet extends MIDlet {
    private MapView mapView;
    private MainView mainView;
    private ViewNewPlace newPlaceView;
    private ViewAboutUs aboutView;
    private ViewGuide guideView;
    private ViewDetailPlace detailView;
    
    private Map map;
    public String filename = "";
    public Place currentPlace;

    public void startApp() {
        Display.init(this);
        createView();
        showMainView();
    }
    
    private void createView() {
        map = new Map(javax.microedition.lcdui.Display.getDisplay(this), null);
        mapView = new MapView(this, map);
        mainView = new MainView(this);
        newPlaceView = new ViewNewPlace(this);
        aboutView = new ViewAboutUs(this);
        guideView = new ViewGuide(this);
        detailView = new ViewDetailPlace(this);
    }
    
    public Map getMap() {
        return map;
    }
    
    public void showMainView() {     
        mainView.show();
    }
    
    public void showMapView() {
    //    MapView mapView = new MapView(this, map);
        mapView.show();
   //     mapView = null;
    }
    
    public void showDetailPlaceView() {
        detailView.setPlace(currentPlace);
        detailView.show();
    }
    
    public void showNewPlaceView() {
        newPlaceView.show();
    }
    
    public void showAboutUs() {
        aboutView.show();
    }
    
    public void showGuideView() {
        guideView.show();
    }
    
//    public ViewDetailPlace getViewDetaiPlace() {
//        return detailView;
//    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
        Display.getInstance().exitApplication();
    }
}
